#!/bin/env perl
my @lines = ();
if ($ARGV[0])
{
	@lines = `ps ax|grep $ARGV[0]`;
}
#print @lines, "\n";

my $pid_args = '';

foreach $line (@lines)
{
	#remove the leading whitespaces
	$line =~ s/^\s+//;
	if ($line =~ /grep/)  {next;}
	if ($line =~ /gdb/) {next;}
	if ($line =~ /top/) {next;}
	#print $line;
	@words = split(/ /, $line);
	#print @words;
	#print $words[0], "\n";
	$pid_args .= "-p $words[0] ";
}
if (! $pid_args)
{
	print "Not found specified process!\n";
	exit(0);
}
#print "pid_args:[$pid_args]\n";
exec("top $pid_args");

